<table  class="display table table-hover table-bordered table-striped attendencetable" id="dynamic-table">
    <thead>
        <tr>
            <th class="sorting" style="width:82px;">工号</th>
            <th style="width:90px">姓名</th>
            <th>部门</th>
            <th class="handshape" style="text-align: center;">加班(时)<i class="fa" ></i></th>
            <th class="specialline handshape" style="text-align: center;">出勤(排名)<i class="fa" ></i></th>
            <th class="specialline handshape" style="text-align: center;">加班(排名)<i class="fa" ></i></th>
            <th class="handshape" style="text-align: center;">请假(时)<i class="fa" ></i></th>
            <th class="handshape" style="text-align: center;">请假(次)<i class="fa" ></i></th>
            <!--<th>旷工(天)<i class="fa icon-sort-amount-asc" ></i></th>-->
            <!--<th>加班(次)<i class="fa icon-sort-amount-asc" ></i></th>-->
            <th style="text-align: center;">明细</th>
        </tr>
    </thead>
    <tbody>
    <volist name="list" id="vo">
        <tr class="gradeX">
            <td>{$vo.id}</td>
            <td>{$vo.man}</td>
            <td>{$vo.position}</td>
            <td style="text-align: center;">{$vo.madhour}</td>
            <td  class="specialline" style="text-align: center;">{$vo.onduty}</td>
            <td  class="specialline" style="text-align: center;">{$vo.madsort}</td>
            <td style="text-align: center;">{$vo.leavehour}</td>
            <td style="text-align: center;">{$vo.leavecount}</td>
            <!--<td>{$vo.neglect}</td>-->
            <!--<td>{$vo.madcount}</td>-->
            <td onClick="_openWindow('<?php echo U('attdetail',array('member'=>$vo['member_id'],'start'=>$start,'end'=>$end)); ?>',600,'【{$vo.man}】个人考勤情况','确定',null,'')"  style="text-align: center; cursor:pointer;">明细</td>
        </tr>
    </volist>
    </tbody>
</table>
<style>
    .sort{display:inline-block;height:20px;width:20px;vertical-align: middle;}
    .table th{border-bottom: none!important;}
</style>
<script>
    $(document).ready(function(){
        $('.attendencetable thead th').each(function(){
            $(this).attr('click','0');//归零
            if($.session.get('th_'+$(this).index())){
                $(this).attr('click', $.session.get('th_'+$(this).index()));//逐一赋值
            }
            $.session.set('th_'+$(this).index(),'0');//先清零,防止页面出问题
            if($(this).index()>2 && $(this).index()<8){
                $(this).children('i').addClass('icon-unsorted');
                if($(this).attr('click')=='0'){
                    $(this).children('i').removeAttr('class').addClass('fa icon-unsorted');
                }else if($(this).attr('click')=='1'){
                    $(this).children('i').removeAttr('class').addClass('fa icon-sort-down');
                }else if($(this).attr('click')=='2'){
                    $(this).children('i').removeAttr('class').addClass('fa icon-sort-up');
                }
                $(this).click(function(){
                    if($(this).attr('click')=='0'){
                        $('.attendencetable thead th').attr('click','0');
                        $(this).attr('click','1');
                        $.session.set('th_'+$(this).index(),'1');//后赋值
                    }else if($(this).attr('click')=='1'){
                        $('.attendencetable thead th').attr('click','0');
                        $(this).attr('click','2');
                        $.session.set('th_'+$(this).index(),'2');
                    }else if($(this).attr('click')=='2'){
                        $('.attendencetable thead th').attr('click','0');
                        $(this).attr('click','1');
                        $.session.set('th_'+$(this).index(),'1');
                    }
                    $("#myajaxform input[name='type']").val($(this).index()+'_'+$(this).attr('click'));
                    $('#myajaxform').submit();
                });
            }
        });
    });
</script>